//滑动窗口
class Solution {
public:
    int maxArea(vector<int>& height) {
        int n=height.size();
        int left=0, right=n-1, ans=0;
        while(left<right)
        {
            ans=max(ans, (right-left)*min(height[right], height[left]));
            if(height[left]<height[right]) left++;
            else right--;
        }
        return ans;
        
    }
};